#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[]) {
    //服务端路径
    char *l4d2path = "~/steam/l4d2/";
    //开服参数
    char *srcds = "srcds_run -port 27015 +ip 0.0.0.0 +map c2m1_highway +exec server.cfg -tickrate 100";
    char srun[512] = "";
    strncpy(srun, l4d2path, strlen(l4d2path));
    strncat(srun, srcds, strlen(srcds));
    while (1)
        system(srun);  //运行服务器
    return 0;
}